﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Popup.Master" AutoEventWireup="true"
    CodeBehind="ServiceHistory.aspx.cs" Inherits="VSM.ServiceHistory" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function openMultiItemDialog() {
            var tabid = '<%= Request.QueryString["requestType"] %> ';
            javascript: Main.openCustomDialog('../../ItemPopup.aspx?ItemCategory=' + '102', 600, 610, "");
        }

        function disablePopup(sender, evt) {

            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (charCode == 13)
                return true;

            return true;
        }

        function loadJobCard(GID) {
            var url = "P_JobCard.aspx?GeneralID=" + GID;
            window.open(url, '_self');
        }

        function PopupPrint() {
            <%Session["DocumentType"] = "SH"; %> 
            var url = "rptViewer.aspx?type=SH&VIN=" + document.getElementById('txt_VIN').value;
            window.open(url, '_self');
        };
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="DealerCode" runat="server" />
                <h2>
                    Service History</h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                   
                            <table border="0" width="100%" style="background-color: #C9DBF2;">
                                <tr>
                                    <td style="width: 15%" class="FormLineItemAlt">
                                        VIN
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_VIN" runat="server" Width="90%" Enabled="False" 
                                            ClientIDMode="Static"></asp:TextBox>
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Customer Name
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_CusName" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Brand
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_Brand" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Other Name
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_OtherName" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Vehicle Name
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_VehicleName" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Address
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_Address" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Engine No.
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_EngineNo" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Tax Code
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_TaxCode" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Reg. No.
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_RegNo" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Tel
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_Tel" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Key No.
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_KeyNo" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                    <td class="FormLineItemAlt"  style="width: 15%">
                                        Mobile
                                    </td>
                                    <td class="FormLineItemAlt"  style="width: 35%">
                                        <asp:TextBox ID="txt_Mobile" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Model Code
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_Model" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 15%">
                                        Contact Person
                                    </td>
                                    <td class="FormLineItemAlt" style="width: 35%">
                                        <asp:TextBox ID="txt_ContactPerson" runat="server" ClientIDMode="Static" Width="50%"
                                            Enabled="False"></asp:TextBox>
                                        <asp:TextBox ID="txt_PhoneContact" runat="server" ClientIDMode="Static" Width="40%"
                                            Enabled="False"></asp:TextBox>
                                    </td>
                                </tr>
                                
                            </table>
                    <table border="0" width="100%" style="background-color: #D1D4D8;">
                        <tr>
                            <td class="FormLineItemAlt" >
                                <asp:Button ID="btn_Filter" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" Text="Filter" Width="100px" onclick="btn_Filter_Click" />
                                <asp:Button ID="btn_Print" runat="server" BackColor="#1B7FC2" 
                                    ForeColor="#FFFFFF" Height="30px" Text="Print" Width="100px" OnClientClick='PopupPrint();' />
                                <asp:HiddenField ID="hf_GeneralID" runat="server" ClientIDMode="Static" />
                            </td>
                        </tr>
                    </table>
                </div>

                
                    <div style="width: 100%; height: 400px; overflow: scroll">

                   
                    <asp:GridView ID="grvPO" runat="server" CssClass="GridInner"  BorderColor="White" Width = "1200px"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" CellSpacing="2" 
                             HeaderStyle-VerticalAlign="Middle" 
                            AllowPaging="True" >
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
 <%--                               <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="10px" />--%>
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center"  Width="60px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Button ID="btnDetail" runat="server" Text="RO" Width="60px"  BackColor="#1B7FC2" ForeColor="#FFFFFF" OnClientClick='<%#"loadJobCard(\"" +Eval("GeneralID") +"\");" %>'/>
                                         
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="30px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Date In">
                                    <ItemStyle HorizontalAlign="Left" Width="100px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbDateIn" runat="server" Text='<%# Bind("DateIn","{0:dd/MM/yyyy}") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Actual Delivery">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbDateOut" runat="server" Width="97%" Text='<%# Bind("ActualDelivery","{0:dd/MM/yyyy}") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Odometer">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbOdometer" runat="server" Width="97%" Text='<%# Bind("Odometer") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <asp:TemplateField HeaderText="Job ID">
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbRONo" Style="text-align: left" runat="server" Text='<%# Bind("JobID") %>'/>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Service Staff">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbSvcStaff" runat="server" Width="97%" Text='<%# Bind("Receptionist") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>

                                 <asp:TemplateField HeaderText="Request">
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle VerticalAlign="Middle" Width="200px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbCustomerRequest" Style="text-align: left" runat="server" Text='<%# Bind("CustomerRequest") %>'/>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                            </Columns>
                            <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                        </asp:GridView>

                    </div>
                <table width="100%" border="0">
                    <tr>
                        <td>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 220px;">
                                      
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
